package com.qk.management.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qk.common.PageResult;
import com.qk.dto.Log.LogDTO;
import com.qk.entity.OperateLog;
import com.qk.management.mapper.OperateLogMapper;
import com.qk.management.service.OperateLogService;
import com.qk.vo.Log.LogVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author kaoM1Jy
 * @date 2025/10/17 18:05
 * @description:
 */
@Service
public class OperateLogServiceImpl extends ServiceImpl<OperateLogMapper, OperateLog> implements OperateLogService {

    @Override
    public PageResult<LogVO> getOperateLogs(LogDTO dto) {
        Page pages = new Page<>(dto.getPage(), dto.getPageSize());
        Page<LogVO> pageResult = this.baseMapper.selectLogs(pages, dto);
        return PageResult.<LogVO>builder()
                .total(Long.valueOf(pages.getTotal()).intValue())
                .rows(pageResult.getRecords())
                .build();

    }
}
